#!/usr/bin/env python

def get_ipaddr ():
	"""
	get_ipaddr () -> list

	Returns a list of available IPs for the current host.
	"""
	import socket, platform, os

	addrs = []

	if platform.system () == 'Linux':
		for line in [ l.strip () for l in os.popen ( "ifconfig" ).readlines () ]:
			if line.startswith ( "inet addr:" ):
				addr = line [ 10 : line.find ( " ", 10 ) ]
				if not addr.startswith ( "127." ): 
					addrs.append ( addr )

	elif platform.system () == 'Windows':
		res = socket.gethostbyname ( socket.gethostname () )

		addrs.append ( res )

	return addrs

if __name__ == '__main__':
	print get_ipaddr ()
